<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    We are using Node.js <span id="node-version"></span>,
    Chromium <span id="chrome-version"></span>,
    and Electron <span id="electron-version"></span>.
    <button id="local-list">打开本地文件local-list.html</button>


	<script>
		const electron = require("electron");
		const path = require("path");

		let BrowserWindow = electron.remote.BrowserWindow;


		let bilibiliWindow = null;
		let youtubeWindow = null;
		let localListWindow = null;

		document.getElementById("local-list").onclick = function(){
			let localListWindow = new BrowserWindow ({
				width: 1000,
				height:800,
				webPreferences: {
					nodeIntegration: true,
					// preload: path.join(__dirname, 'preload.js')
				}
			})

			localListWindow.loadURL(`file://${__dirname}/local-list.html`);
			localListWindow.webContents.openDevTools();

			localListWindow.on("close", function(){
				localListWindow = null;
			})
		}
	</script>
  </body>
</html>
